﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Core.DMS;

namespace dms.Controls
{
    public partial class FileList : System.Web.UI.UserControl
    {
        List<Document> _data = null;
        ViewMode _mode = ViewMode.List;
        
        public List<Document> DataSource { get { return _data; } set { _data = value; } }
        public ViewMode ViewMode { get { return _mode; } set { _mode = value; } }

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        public override void DataBind()
        {
            switch (ViewMode)
            {
                case ViewMode.Thumbs:
                    ui_lstThumbs.DataSource = _data;
                    ui_lstThumbs.DataBind();
                    Thumbs.Visible = true;
                    Gallery.Visible = false;
                    List.Visible = false;
                    break;
                case ViewMode.Gallery:
                    ui_lstGallery.DataSource = _data;
                    ui_lstGallery.DataBind();
                    Thumbs.Visible = false;
                    Gallery.Visible = true;
                    List.Visible = false;
                    break;
                default:
                    ui_lstList.DataSource = _data;
                    ui_lstList.DataBind();
                    Thumbs.Visible = false;
                    Gallery.Visible = false;
                    List.Visible = true;
                    break;
            }
            base.DataBind();
        }
    }
}